let noStudentToast = {};
noStudentToast.install = function (Vue, options) {
    let opt = {
        tips:'暂时没有学员 请添加学员'
    };
    Vue.prototype.$noStudentToast = (tips,callBack,cancelCallBack) => {
        if(document.getElementById('noStudentToast')){
            // 如果toast还在，则不再执行
            return;
        }
        if(tips){
            opt.tips=tips;
        }
        let toastTpl = Vue.extend({
            template: `<div id="noStudentToast">
                            <div class="alert">
                                <div class="top" flex="main:center cross:center">
                                    ${opt.tips}
                                </div>
                                <div class="bottom" flex="main:center cross:center">
                                    <div class="leftBtn" @click="remove" flex-box="1" flex="main:center cross:center">取消</div>
                                    <div class="middleLine" flex-box="0"></div>
                                    <div class="rightBtn" @click="remove" flex-box="1" flex="main:center cross:center">确定</div>
                                </div>
                            </div>
                        </div>`,
            data: function () {
                return {

                }
            },
            methods:{
                remove(boolen){
                    remove(boolen);
                }
            }
        });
        let tpl = new toastTpl().$mount().$el;
        document.body.appendChild(tpl);
        function remove(boolen) {
            if(boolen&&callBack){
                callBack();
            }
            if(!boolen&&cancelCallBack){
                cancelCallBack();
            }
            document.body.removeChild(tpl);
        }
    };
};
export default noStudentToast;
